<?php

namespace App\Services\Article;

use App\Services\ProjectValidate;

/**
 * 文章分类设置验证
 * Class ValidateSetting
 * @package App\Services\Setting
 */
class ValidateArticleClassify extends ProjectValidate
{

    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
            if (!empty($initData['status'])) {
                $this->rules['status'] = 'in:0,1';
            }
    }


    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'name'   => 'string|min:2',
        'key'    => 'min:0|max:32',
        'id'     => 'int|min:1',
        'pid'    => 'int|min:0',
        'status' => 'in:-1,0,1',
        'add_user_id' => 'integer|min:1',
        'order' => 'integer|min:0',
    ];


    /**
     * @var array 当前验证错误信息
     */
    public $messages = [

    ];


}